const assert  = require("assert");
const CSVReader = require('../model/AIAnalyzeCSVReader');

let analyzes = new Map();
CSVReader.readCSVAsyn().then((rows)=>{
    for (var i = 1; i < rows.length; i++) {
        let analyze = CSVReader._createAnalyze(rows[i]);
        console.error(JSON.stringify(analyze));
        analyzes.set(analyze.cameraId, analyze);
    }
    console.error(analyzes);
    analyzes.forEach((analyze, id) => {
        console.error(JSON.stringify(analyze) + ";id:" + id + "\r\n");
    });
    assert.equal(analyzes.size, 2);
});


let analyzes2 = CSVReader.readCSV();
console.error(analyzes2);
assert.notEqual(analyzes2, null);
assert.equal(analyzes2.size, 2);

//assert.equal(analyzes.length, 2);
